//
//  TDTerm.m
//  TFB
//
//  Created by Nothing on 15/4/1.
//  Copyright (c) 2015年 TD. All rights reserved.
//

#import "TDTerm.h"

@implementation TDTerm

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        _ratesArray = [[NSMutableArray alloc] init];
        self.agentId = [dictionary objectForKey:@"agentId"];
        self.termNo = [dictionary objectForKey:@"termNo"];
        if ([[dictionary objectForKey:@"termList"] isKindOfClass:[NSArray class]]) {
            NSArray *tempArray = [dictionary objectForKey:@"termList"];
            for (int i = 0; i < tempArray.count; i ++) {
                TDRate *rate = [[TDRate alloc] initWithDictionary:tempArray[i]];
                [_ratesArray addObject:rate];
            }
        }
    }
    
    return self;
}

@end


@implementation TDRate

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self.rateDesc = [dictionary objectForKey:@"rateDesc"];
        self.rateNo = [dictionary objectForKey:@"rateNo"];
        self.rateMaximun = [dictionary objectForKey:@"rateMaximun"];
    }
    return self;
}

@end